<!DOCTYPE html>
<title>Test "abort" event.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<video></video>
<script>
async_test(function(t) {
    var video = document.querySelector("video");
    // Test before movie is open.
    assert_equals(video.error, null);
    video.onerror = t.unreached_func();

    var watcher = new EventWatcher(t, video, ["loadstart", "abort", "canplaythrough"]);
    watcher.wait_for("loadstart").then(t.step_func(function() {
        assert_equals(video.error, null);
        video.load();
        return watcher.wait_for("abort");
    })).then(t.step_func(function() {
        assert_equals(video.error, null);
        return watcher.wait_for("loadstart");
    })).then(t.step_func(function() {
        assert_equals(video.error, null);
        return watcher.wait_for("canplaythrough");
    })).then(t.step_func_done(function() {
        assert_equals(video.error, null);
    }));

    var movie = "../resources/test.ogv";
    video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?name=" + movie + "&throttle=256";
});
</script>